﻿@model PhoneBilling.Models.SourcePhnModel
@{
    ViewBag.Title = "原始话单查询";
    Layout = "~/Views/Shared/_Layout.cshtml"; 
}
<script type="text/javascript">
    $(document).ready(
function () {
    $("#date1").ligerDateEditor({ showTime: true, label: '起始时间', initValue: '@Model.起始时间.ToString("yyyy-MM-dd HH:mm")', format: "yyyy-MM-dd hh:mm" });
    $("#date2").ligerDateEditor({ showTime: true, label: '终止时间', initValue: '@Model.终止时间.ToString("yyyy-MM-dd HH:mm")', format: "yyyy-MM-dd hh:mm" });

    change1();
    change2();
    change3();
}
);

    function changeAreaType() {
        var str = "";
        $(".areaType").each(function () {
            if ($(this).attr("checked") == "checked") {
                str += $(this).attr("id");
            }
        });
        $("#areaType").val(str);
    }

    function change1() {
        $("#check1").attr("disabled", $(".check1").attr("checked") != "checked");
    }

    function change2() {
        $("#check2").attr("disabled", $(".check2").attr("checked") != "checked");
    }

    function change3() {
        $(".areaType").attr("disabled", $(".check3").attr("checked") == "checked");
    }

    function exportClick() {
        changeAreaType();
        $(".export").val("True");
    }

    function searchClick() {
        changeAreaType();
        $(".export").val("False");
    }

</script>
<script type="text/javascript">
    $(document).ready(function () {
        $("#btnSearch").ligerButton(
        {
            click: function () {
                searchClick();
            }
        });
        $("#btnImport").ligerButton(
        {
            click: function () {
                exportClick();
            }
        });
    });
    
</script>
@using (Html.BeginForm())
{
    <div class="source_phn">
        @Html.HiddenFor(m => m.IsExport, new { @class = "export" })
        <div class="system_contain_group">
            <h3 class="title">
                拨出信息</h3>
            <div class="system_input_contain">
                @Html.LabelFor(m => m.主叫分机)
                @Html.TextBoxFor(m => m.主叫分机)
                @Html.LabelFor(m => m.拨出号码)
                @Html.TextBoxFor(m => m.拨出号码)
            </div>
            <div class="system_input_contain">
                @Html.TextBox("起始时间", Model.起始时间, new { @id = "date1" })
                @Html.TextBox("终止时间", Model.终止时间, new { @id = "date2" })
            </div>
        </div>
        <div class="system_contain_group">
            <h3 class="title">
                花费金额</h3>
            <div class="system_input_contain system_checkbox">
                @Html.CheckBoxFor(m => m.Is金额上, new { onclick = "change1()", @class = "check1" })
                @Html.LabelFor(m => m.金额上)
                @Html.TextBoxFor(m => m.金额上, new { id = "check1" })
                @Html.CheckBoxFor(m => m.Is金额下, new { onclick = "change2()", @class = "check2" })
                @Html.LabelFor(m => m.金额下)
                @Html.TextBoxFor(m => m.金额下, new { id = "check2" })
            </div>
        </div>
        <div class="system_contain_group">
            <h3 class="title">
                话类</h3>
            <div class="system_input_contain system_checkbox">
                @Html.CheckBoxFor(m => m.所有话类, new { onclick = "change3()", @class = "check3" })
                @Html.LabelFor(m => m.所有话类)
                @Html.HiddenFor(m => m.话类, new { id = "areaType" })
                @for (int i = 0; i < Model.话类List.Count; i++)
                {
                    <div class="system_checkbox">
                        @Html.CheckBoxFor(m => m.话类List[i].IsSelected, new { onclick = "changeAreaType()", @class = "areaType", id = Model.话类List[i].ID })
                        @Html.Label(string.Format(" {0} ", Model.话类List[i].Name))
                    </div>
                }
            </div>
        </div>
        <div class="system_input_contain">
            <input type="button" id="btnSearch" value="查询" />
            <input type="button" id="btnImport" value="导出Excel" />
            @*            <input type="submit" value="查询" class="input-submit" onclick="searchClick()" />
            <input type="submit" value="导出Excel" class="input-submit" onclick="exportClick()" />*@
        </div>
    </div>
}
